package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.CategoryDTO;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import lombok.AllArgsConstructor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;


@Mapper
public interface CategoryMapper {

    @Insert("insert into category(id,type,name,sort,status," +
            "create_time,update_time,create_user,update_user) values (" +
            "#{id},#{type},#{name},#{sort},#{status},#{createTime}," +
            "#{updateTime},#{createUser},#{updateUser}) ")
    void save(Category category);

    Page<Category> pageQuery(CategoryPageQueryDTO categoryPageQueryDTO);

    @Update("update category set status = #{status} where id = #{id}")
    void updateStatus(Integer status, Long id);

    void update(Category category);

    @Delete("delete from category where id = #{id}")
    void deleteById(Long id);
}
